home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / daemons / ipServer / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-02  |  8.1 KB  |  224 lines

  1. /*
  2.  * stat.h --
  3.  *
  4.  *    Data structure declartions for recording statistics from the
  5.  *    Internet protocol modules.
  6.  *
  7.  * Copyright 1987 Regents of the University of California
  8.  * All rights reserved.
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that the above copyright
  12.  * notice appear in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  *
  17.  *
  18.  * $Header: /sprite/src/daemons/ipServer/RCS/stat.h,v 1.1 89/09/02 14:40:04 rab Exp $ SPRITE (Berkeley)
  19.  */
  20.  
  21. #ifndef _IPS_STAT
  22. #define _IPS_STAT
  23.  
  24. #include "spriteTime.h"
  25. #include "netInet.h"
  26.  
  27. /* constants */
  28.  
  29. /* data structures */
  30.  
  31. typedef struct {
  32.  
  33.     Time    startTime;        /* Time when server started. */
  34.  
  35.     struct {
  36.     unsigned int    totalRcv;    /* Total # of packets received. */
  37.     unsigned int    shortPacket;    /* Packet len. was smaller than the
  38.                     *  min. IP header size. */
  39.     unsigned int    shortHeader;    /* The headerLen value in the header
  40.                      * wass smaller that the min. header 
  41.                      * size. */
  42.     unsigned int    shortLen;    /* The headerLen was bigger than the
  43.                      * totalLen. */
  44.     unsigned int    badChecksum;    /* Checksum didn't match recomputed 
  45.                      * value.*/
  46.     unsigned int    fragsRcv;    /* # of packets received that were 
  47.                      * fragmented when they arrived. */
  48.     unsigned int    fragsDropped;    /* # of fragments received that were
  49.                      * dropped because they were replaced
  50.                      * by other fragments. */
  51.     unsigned int    fragsTimedOut;    /* # of fragments received that were
  52.                      * dropped because the other fragments
  53.                      * didn't arrive before the timeout.*/
  54.     unsigned int    fragTimeouts;    /* # of fragments reassembly timeouts.*/
  55.     unsigned int    fragsReass;    /* # of fragments that were 
  56.                      * reasssembled. */
  57.     unsigned int    forwards;    /* # of received packets that weren't
  58.                      * for us and had to be forwarded. */
  59.     unsigned int    cannotForward;    /* # of packets to be forwarded but
  60.                      * couldn't determine who to send to. */
  61.  
  62.     unsigned int    wholeSent;    /* # of unfragmented packets sent. */
  63.     unsigned int    fragOnSend;    /* # of packets that were fragmented 
  64.                      * before sent because they were too
  65.                      * big to send whole. */
  66.     unsigned int    fragsSent;    /* # of fragments sent. */
  67.     unsigned int    dontFragment;    /* # of packets to be sent that were
  68.                      * too big but couldn't be fragmented 
  69.                      * (DONT_FRAGMENT was set). */
  70.     } ip;
  71.  
  72.     struct {
  73.     unsigned int    total;
  74.     unsigned int    shortLen;
  75.     unsigned int    badChecksum;
  76.     unsigned int    badType;    /* # of packets that had a bad ICMP
  77.                      * request type. */
  78.     unsigned int    badCode;    /* # of packets with a bad ICMP code. */
  79.     unsigned int    redirectSent;    /* # of "redirect" packets sent out. */
  80.  
  81.     unsigned int    inHistogram[NET_ICMP_MAX_TYPE];    
  82.                     /* histogram of request types in 
  83.                      * incoming ICMP packets. */
  84.     unsigned int    outHistogram[NET_ICMP_MAX_TYPE];
  85.                     /* histogram of request types in 
  86.                      * outgoing ICMP packets. */
  87.     } icmp;
  88.  
  89.     struct {
  90.     struct {
  91.         unsigned int    total;
  92.         unsigned int    dataLen;    /* # of bytes sent. */
  93.     } send;
  94.     struct {
  95.         unsigned int    total;        /* total # received. */
  96.         unsigned int    dataLen;    /* total # of valid bytes 
  97.                          * received. */ 
  98.         unsigned int    shortLen;    /* bad length in header. */
  99.         unsigned int    badChecksum;    /* bad header checksum. */
  100.         unsigned int    daemon;        /* destined for rwhod, sunrpc
  101.                          * and route daemons. */
  102.         unsigned int    accepted;    /* a client wants the packet.*/
  103.         unsigned int    acceptLen;    /* # of bytes wanted. */
  104.     } recv;
  105.     } udp;
  106.  
  107.     struct {
  108.     unsigned int    connAttempts;    /* connections initiated */
  109.     unsigned int    accepts;    /* connections accepted */
  110.     unsigned int    connects;    /* connections established */
  111.     unsigned int    drops;        /* connections dropped */
  112.     unsigned int    connDrops;    /* embryonic connections dropped */
  113.     unsigned int    closed;        /* conn. closed (includes drops) */
  114.     unsigned int    segsTimed;    /* segs where we tried to get rtt */
  115.     unsigned int    rttUpdated;    /* times we succeeded */
  116.     unsigned int    delayAck;    /* delayed acks sent */
  117.     unsigned int    timeoutDrop;    /* conn. dropped in rxmt timeout */
  118.     unsigned int    rexmtTimeout;    /* retransmit timeouts */
  119.     unsigned int    persistTimeout;    /* persist timeouts */
  120.     unsigned int    keepTimeout;    /* keepalive timeouts */
  121.     unsigned int    keepProbe;    /* keepalive probes sent */
  122.     unsigned int    keepDrops;    /* connections dropped in keepalive */
  123.     unsigned int    mslTimeout;    /* 2*MSL timeouts. */
  124.     unsigned int    timerCalls;    /* # times the timeout handler is 
  125.                      * called.*/
  126.  
  127.     struct {
  128.         unsigned int    total;    /* total packets sent */
  129.         unsigned int    pack;    /* data packets sent */
  130.         unsigned int    byte;    /* data bytes sent */
  131.         unsigned int    rexmitPack;    /* data packets retransmitted */
  132.         unsigned int    rexmitByte;    /* data bytes retransmitted */
  133.         unsigned int    acks;    /* ack-only packets sent */
  134.         unsigned int    probe;    /* window probes sent */
  135.         unsigned int    urg;    /* packets sent with URG only */
  136.         unsigned int    winUpdate;/* window update-only packets sent */
  137.         unsigned int    ctrl;    /* control (SYN|FIN|RST) packets sent */
  138.     } send;
  139.  
  140.     struct {
  141.         unsigned int    total;    /* total packets received */
  142.         unsigned int    pack;    /* packets received in sequence */
  143.         unsigned int    byte;    /* bytes received in sequence */
  144.         unsigned int    badChecksum;    /* packets rcvd with checksum 
  145.                          * errors */
  146.         unsigned int    badOffset;    /* packets rcvd with bad 
  147.                          * offset */
  148.         unsigned int    shortLen;    /* packets received too short */
  149.         unsigned int    dupPack;    /* duplicate-only packets rcvd*/
  150.         unsigned int    dupByte;    /* duplicate-only bytes recvd */
  151.         unsigned int    partDupPack;    /* packets with some duplicate 
  152.                          * data */
  153.         unsigned int    partDupByte;    /* dup. bytes in part-dup. 
  154.                          * packets */
  155.         unsigned int    ooPack;        /* out-of-order packets recvd */
  156.         unsigned int    ooByte;        /* out-of-order bytes recvd */
  157.         unsigned int    packAfterWin;    /* packets with data after 
  158.                          * window */
  159.         unsigned int    byteAfterWin;    /* bytes rcvd after window */
  160.         unsigned int    afterClose;    /* packets rcvd after "close" */
  161.         unsigned int    winProbe;    /* rcvd window probe packets */
  162.         unsigned int    dupAck;        /* rcvd duplicate acks */
  163.         unsigned int    ackTooMuch;    /* rcvd acks for unsent data */
  164.         unsigned int    ackPack;    /* rcvd ack packets */
  165.         unsigned int    ackByte;    /* bytes acked by rcvd acks */
  166.         unsigned int    winUpd;        /* rcvd window update packets */
  167.         unsigned int    urgent;        /* #packets with urgent data.*/
  168.         unsigned int    urgentOnly;    /* #packets with only urgent 
  169.                          * data.*/
  170.     } recv;
  171.  
  172.     } tcp;
  173.  
  174.     struct {
  175.     struct {
  176.         unsigned int    total;        /* # packets recv'd with an 
  177.                            *  unknown protocol. */
  178.         unsigned int    accepted;    /* a client wants the packet.*/
  179.     } recv;
  180.     struct {
  181.         unsigned int    total;        /* # raw packets sent. */
  182.         unsigned int    dataLen;    /* #bytes sent in raw packets.*/
  183.     } send;
  184.     } raw;
  185.  
  186.     /*
  187.      * Socket-related statitics.
  188.      */
  189.     struct {
  190.     unsigned int    open;        /* # of socket opens. */
  191.     unsigned int    close;        /* # of socket closes. */
  192.     unsigned int    read;        /* # of socket reads. */
  193.     unsigned int    write;        /* # of socket writes. */
  194.     unsigned int    ioctl;        /* # of socket ioctls. */
  195.     unsigned int    select;        /* # of socket select. */
  196.     struct {
  197.         unsigned int append;    /* # of socket buffer appends. */
  198.         unsigned int appendPartial;    /* # of socket buffer appends that
  199.                      * didn't append the full amount. */
  200.         unsigned int appPartBytes;    /* # of bytes partially appended. */
  201.         unsigned int appendFail;    /* # of socket buffer appends that
  202.                      * failed because the buffer was full.*/
  203.         unsigned int remove;    /* # of socket buffer removals. */
  204.         unsigned int fetch;        /* # of socket buffer fetches. */
  205.         unsigned int copy;        /* # of socket buffer copies. */
  206.         unsigned int copyBytes;    /* # of bytes copied. */
  207.     } buffer;
  208.     } sock;
  209.  
  210.     struct {
  211.     unsigned int dispatchLoop;    /* # of times Fs_Dispatch is called. */
  212.     unsigned int routeCalls;    /* # of times Rte_FindOutNet is 
  213.                      * called. */
  214.     unsigned int routeCacheHits;    /* # of times the cache in 
  215.                      * Rte_FindOutNet is used. */
  216.     } misc;
  217.  
  218. } Stat_Info;
  219.  
  220. extern Stat_Info    stats;
  221. extern int        Stat_PrintInfo();
  222.  
  223. #endif _IPS_STAT
  224.